<!-- @format -->

<template>
  <div class="dialog-401-example">
    <h2 class="title">登录过期弹框示例</h2>

    <div class="button-group">
      <comp-button @click="showDialog401" text="显示登录过期弹框" />
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  import CompButton from '@/components/comp-button.vue';
  import Dialog401 from './index';

  // 显示登录过期弹框
  const showDialog401 = () => {
    Dialog401({
      onConfirm: () => {
        console.log('用户点击了确认按钮，将跳转到登录页');
        // 在实际应用中，这里会自动跳转到登录页
      },
      onCancel: () => {
        console.log('用户点击了取消按钮');
      },
      redirectUrl: '/login', // 可以自定义登录页路径
    });
  };
</script>

<style lang="scss" scoped>
  .dialog-401-example {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
  }

  .title {
    font-size: 24px;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
  }

  .button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  @media screen and (max-width: 768px) {
    .button-group {
      flex-direction: column;
      align-items: center;
    }
  }
</style>
